from .base import *


class Blog(Base):
    """ 笔记 """
    __tablename__ = 'blog'

    bid = Column(Integer, primary_key=True)
    title = Column(String(40), nullable=False,server_default=text("'无标题'"), comment='标题')
    create_time = Column(Integer, nullable=False, comment='创建时间')
    uid = Column(Integer, nullable=False, server_default=text('0'), comment='用户id')
    status = Column(Integer, nullable=False, server_default=text('0'), comment='上线状态 0 删除 1 存在')
    is_show = Column(Integer, nullable=False, server_default=text('0'), comment='是否显示 0 不显示 1 显示')
    collection = Column(Integer, nullable=False, server_default=text('0'), comment='收藏数量')
    observation = Column(Integer, nullable=False, server_default=text('0'), comment='浏览量')


class BlogCollection(Base):
    """ 笔记收藏量 """
    __tablename__ = 'blog_collection'

    id = Column(Integer, primary_key=True)
    bid = Column(Integer, nullable=False, comment='杂志id')
    uid = Column(Integer, nullable=False, comment='用户id')


class BlogObservation(Base):
    """ 笔记浏览量 """
    __tablename__ = 'blog_observation'

    id = Column(Integer, primary_key=True)
    bid = Column(Integer, nullable=False, comment='笔记id')
    uid = Column(Integer, nullable=False, comment='用户id')


class BlogTag(Base):
    """ 笔记标签 """
    __tablename__ = 'blog_tag'

    btid = Column(Integer, primary_key=True)
    title = Column(String(40), nullable=False, comment='标签名')
    num = Column(Integer, nullable=False, comment='应用标签数量')


class BlogLinkTag(Base):
    """ 笔记标签链接 """
    __tablename__ = 'blog_link_tag'

    id = Column(Integer, primary_key=True)
    bid = Column(Integer, nullable=False, comment='笔记id')
    btid = Column(Integer, nullable=False, comment='标签id')
